extends Node

enum CollisionType
{
	NORMAL,
	INVERTED
}

@export var color : Globals.Colors = Globals.Colors.WHITE
@export var collision_type : CollisionType = CollisionType.NORMAL

const color_mask : int = 0b11111111111111110000000000000000

func _ready() -> void:
	var parent = get_parent()
	match collision_type:
		CollisionType.NORMAL:
			parent.set_collision_layer_value(color, true)
			parent.set_collision_mask_value(color, true)
		CollisionType.INVERTED:
			#It isn't so obvious but even if object is green, it will be on all
			# color layers except green
			parent.collision_mask = color_mask ^ parent.collision_mask
			parent.collision_layer = color_mask ^ parent.collision_layer
			parent.set_collision_layer_value(color, false)
			parent.set_collision_mask_value(color, false)
			
